<?php
class User_model extends CI_Model
{
	public $mid = '';
	public $userid = '';
	public $uname = '';
	public $pwd = '';
	public $email = '';
	public $sex = '';
	public $jointime = '';
	public $joinip = '';
	public $logintime = '';
	public $loginip = '';

	public function __construct()
	{
		parent::__construct();
		$this->load->database();
		$this->load->helper('cookie');
		$this->mid = get_cookie('youley_mid');

	}		

	//判断用户是否登录
	public function IsLogin()
	{
		if ($this->mid > 0) return TRUE;
		else return FALSE;
	}

	//写一个测试cookie值
	public function Add_test_cookie($mid=5)
	{
		$mid = intval($mid);
		set_cookie('youley_mid', $mid, 0);
	}
	
	//测试：清空cookie
	public function Clear_cookie()
	{
		delete_cookie('youley_mid');
	}


}
